<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMenusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('menus', function (Blueprint $table) {
            $table->string('code')->primary();
            $table->string('parent_code')->default('top')->index()->comment('父ID');
            $table->string('name')->comment('名称');
            $table->string('icon')->nullable()->comment('图标');
            $table->string('uri')->nullable()->comment('前端路由');
            $table->integer('sort')->default(0)->comment('菜单排序');
            $table->boolean('status')->default(1)->comment('状态');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('menus');
    }
}
